/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 combat_actor_model.cpp

	$Header: /heroes4/combat_actor_model.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "combat_actor_model.h"

#include "actor_model_impl.h"
#include "actor_sequence_cache.h"

// Explicitly instantiate t_actor_model< t_combat_actor_model_definition >
// This will cause all member functions to be instantiated
#pragma warning( push )
#pragma warning( disable: 4660 )
template t_actor_model< t_combat_actor_model_definition >;
#pragma warning( pop )

// ------------------------------------------------------------------------------
// t_combat_actor_model members
// ------------------------------------------------------------------------------

// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
t_combat_actor_model::t_combat_actor_model( t_combat_actor_model const & other )
	:	t_actor_model< t_combat_actor_model_definition >( other ),
		m_scale_ratio( other.m_scale_ratio )
{
}

// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
t_combat_actor_model::t_combat_actor_model( t_cached_ptr< t_definition > definition_ptr, double scale_ratio )
	:	t_actor_model< t_combat_actor_model_definition >( definition_ptr ),
		m_scale_ratio( scale_ratio )
{
}

// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
t_combat_actor_model::~t_combat_actor_model()
{
}

// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
t_actor_sequence_cache t_combat_actor_model::get_cache( std::string const &		name,
														t_screen_point const &	offset ) const
{
	if ( m_scale_ratio == 1.0 )
		return get_actor_sequence_cache( name, offset );

	return get_scaled_actor_sequence_cache( name, offset, m_scale_ratio );
}

// ------------------------------------------------------------------------------
// get a sequence by id
// ------------------------------------------------------------------------------
t_actor_sequence_ptr t_combat_actor_model::get_sequence_ptr( t_action_id action_id, 
										                  t_direction direction ) const
{
	assert( action_id >= 0 && action_id < k_action_count );
	assert( direction >= 0 && direction < k_direction_count );

	m_current_sequence = get_sequence_cache( action_id, direction ).get();
	return m_current_sequence;
}

